name: CI for releases

on:
    push:
        branches:
            - master

jobs:
    build:
        runs-on: ubuntu-latest
        steps:
            - name: Checkout
              uses: actions/checkout@v3
            - name: Dockerhub login
              env:
                  DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
              run: |
                  echo "${DOCKER_PASSWORD}" | docker login --username wangqiru --password-stdin
            - name: Set up QEMU
              uses: docker/setup-qemu-action@v1
            - name: Set up Docker Buildx
              uses: docker/setup-buildx-action@v1
            - name: Build dockerfile (with push)
              run: |
                  docker buildx build \
                  --platform=linux/amd64,linux/arm/v7,linux/arm64 \
                  --output "type=image,push=true" \
                  --file ./Dockerfile . \
                  --tag wangqiru/mercury-parser-api:latest
            - name: Notify Awensome-TTRSS repo
              run: |
                  curl -X POST https://api.github.com/repos/HenryQW/Awesome-TTRSS/dispatches \
                  -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' \
                  -H 'Accept: application/vnd.github.everest-preview+json' \
                  --data "{\"event_type\": \"build\"}"
